import request from '@/utils/request'

const {
  get: $get,
  post: $post,
  delete: $delete,
  download: $download
} = request

// =============巡查模板===============
// 列表
export const patrolModelList = data => {
  return $get('/risk/patrolModel/list', data)
}
// 分页
export const patrolModelPage = data => {
  return $get('/risk/patrolModel/page', data)
}
// 新增
export const patrolModelAdd = data => {
  return $post('/risk/patrolModel/add', data)
}
// 详情
export const patrolModelDetail = id => {
  return $get('/risk/patrolModel/detail/'+id)
}
// 更新
export const patrolModelUpdate = (id, data) => {
  return $post('/risk/patrolModel/update/'+id, data)
}
// 删除
export const patrolModelDelete = id => {
  return $post('/risk/patrolModel/delete/'+id)
}
// 更新禁用状态
export const patrolModelUpdateDisable = (id, disableFlag) => {
  return $post('/risk/patrolModel/update/'+id+"/"+ disableFlag)
}
//========================================

// =============计划信息===============
// 分页
export const patrolPlanPage = data => {
  return $get('/risk/patrolPlan/page', data)
}
// 新增
export const patrolPlanAdd = data => {
  return $post('/risk/patrolPlan/add', data)
}
// 更新
export const patrolPlanUpdate = data => {
  return $post('/risk/patrolPlan/update', data)
}
// 详情
export const patrolPlanDetail = id => {
  return $get('/risk/patrolPlan/detail/'+id)
}
// 删除
export const patrolPlanDelete = id => {
  return $post('/risk/patrolPlan/delete/'+id)
}
// 更新禁用状态
export const patrolPlanUpdateDisable = (id,disableFlag) => {
  return $post('/risk/patrolPlan/update/'+id+"/"+disableFlag)
}
// ======================================

// =============计划下发==================
// 分页
export const patrolPlanDistributePage = data => {
  return $get('/risk/patrolPlanDistribute/page', data)
}
// 新增
export const patrolPlanDistributeAdd = data => {
  return $post('/risk/patrolPlanDistribute/add', data)
}
// 详情
export const patrolPlanDistributeDetail = id => {
  return $get('/risk/patrolPlanDistribute/detail/'+id)
}
// 下发（更新）
export const patrolPlanDistributeUpdate = data =>{
  return $post('/risk/patrolPlanDistribute/update',data)
}
// 删除
export const patrolPlanDistributeDelete = id => {
  return $post('/risk/patrolPlanDistribute/delete/'+id)
}
// 更新禁用状态
export const patrolPlanDistributeUpdateDisable = (id,disableFlag) => {
  return $post('/risk/patrolPlanDistribute/update/'+id+"/"+disableFlag)
}
//==========================================

// =============计划分派==================
// 分页
export const patrolPatrolPlanAssignPage = data => {
  return $get('/risk/patrolPlanAssign/page', data)
}
// 详情
export const patrolPatrolPlanAssignDetail = id => {
  return $get('/risk/patrolPlanAssign/detail/'+id)
}
// 分派（更新）
export const patrolPatrolPlanAssignUpdate = data => {
  return $post('/risk/patrolPlanAssign/update', data)
}
// =======================================

//===============计划任务========================
// 分页
export const patrolPatrolTaskPage = data => {
  return $get('/risk/patrolTask/page', data)
}
// 详情
export const patrolPatrolTaskDetail = id => {
  return $get('/risk/patrolTask/detail/'+id)
}
// 填报（更新）
export const patrolPatrolTaskUpdate = data => {
  return $post('/risk/patrolTask/update', data)
}
// 导出
export const patrolPatrolTaskExport = (data, fileName) =>{
  return $download('/risk/patrolTask/export',data, fileName)
}
// 巡查人员列表
export const patrolPatrolPersonList = data => {
  return $get('/risk/patrolTask/patrolPersonPage', data)
}
// 巡查人员列表导出
export const patrolPersonExport = (data, fileName) =>{
  return $download('/risk/patrolTask/patrolPersonExport',data, fileName)
}
// ==============================================

// =============== 巡查统计==========================
// 巡查类型统计(按计划类型)
export const patrolTypeStatistics = data =>{
  return $get('/risk/patrolTask/patrolTypeStatistics', data)
}
// 巡查类型统计（按模板类型）
export const patrolTypeStatisticsNew = data =>{
  return $get('/risk/patrolTask/patrolTypeStatisticsNew', data)
}
// 巡查数量走势
export const patrolTrendStatistics = data =>{
  return $get('/risk/patrolTask/patrolTrendStatistics', data)
}
// 巡查表格
export const patrolTableStatistical = data =>{
  return $get('/risk/patrolTask/patrolTableStatistical', data)
}
